<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>新增政策</title>
		<meta name="keywords" content="">
		<meta name="description" content="">
		<link rel="shortcut icon" href="favicon.ico">

		<link href="__PUBLIC__/static/js/plugins/layui/css/layui.css" rel="stylesheet">
	</head>

	<body class="gray-bg">
		<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
			<legend>新增政策</legend>
		</fieldset>
		<form class="layui-form" action="{:url('Policy/policy_insert')}" method="post">
			<div class="layui-form-item">
				<label class="layui-form-label">政策标题</label>
				<div class="layui-input-inline">
					<input style="width: 500px;" name="news_title" lay-verify="title" value="" autocomplete="off" placeholder="" class="layui-input" type="text">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">政策内容</label>
				<div class="layui-input-block">
					<textarea class="layui-textarea layui-hide" value="" name="news_content" lay-verify="content" id="news_content"></textarea>
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
				</div>
			</div>
		</form>
	</body>
	<script src="__PUBLIC__/static/js/jquery.min.js?v=2.1.4"></script>
	<script src="__PUBLIC__/static/js/plugins/layui/layui.js"></script>
	<script src="__PUBLIC__/static/js/loading.js"></script>
	<!-- Page-Level Scripts -->
	<script src="__PUBLIC__/static/js/newsAdd.js" type="text/javascript" charset="utf-8"></script>
	<script>
		layui.use(['form', 'layedit', 'laydate'], function() {
			var form = layui.form,
				layer = layui.layer,
				layedit = layui.layedit,
				laydate = layui.laydate;
			//自定义验证规则
			form.verify({
				title: function(value) {
					if(value.length < 5) {
						return '标题至少得5个字符啊';
					}
				},
				content: function(value) {
					if(value.length < 30) {
						return '政策内容不得少于30个字符啊';
					}
				}
			});

			//监听提交
			form.on('submit(demo1)', function(data) {
				//关闭当前页面
				var index = parent.layer.getFrameIndex(window.name);
				parent.$("#reload").change();
				parent.layer.close(index);
				//刷新父页面
				parent.location.reload();

			});

		});
	</script>
	</body>

</html>